/* GUI CONVERTED from rcsddelb.p (converter v1.75) Fri Feb  2 06:22:20 2001 */
/* rcsddelb.p - Release Management Customer Schedules                   */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                  */
/* All rights reserved worldwide.  This is an unpublished work.         */
/*F0PN*/ /*V8:ConvertMode=Maintenance                                   */
/*K1Q4*/ /*V8:RunMode=Character,Windows                                 */
/* REVISION: 7.3    LAST MODIFIED: 02/02/96           BY: kjm *G1LT*    */
/* REVISION: 8.6    LAST MODIFIED: 05/15/97           BY: *H0Z4* Suresh Nayak */
/* REVISION: 8.6    LAST MODIFIED: 05/20/98           BY: *K1Q4* Alfred Tan   */
/* REVISION: 8.6    LAST MODIFIED: 08/10/99           BY: *J3K7* Surekha Joshi*/
/* REVISION: 9.1    LAST MODIFIED: 08/12/00           BY: *N0KP* myb          */
/* REVISION: 9.1    LAST MODIFIED: 09/27/00           BY: *N0WD* Mudit Mehta  */


{mfdeclre.i}
/*N0WD*/  {cxcustom.i "RCSDDELB.P"}
/* CHECK FOR EXISTENCE OF A SHIPPER IN SELECTED DATABASE */

     define input parameter sonbr as character.
     define input parameter sodline as integer.
     define input parameter sodsite as character.
     define output parameter shipper_found as integer.
     define output parameter save_abs as character.
/*J3K7*/ define output parameter l_conf_ship as   integer    no-undo.
/*J3K7*/ define output parameter l_conf_shid like abs_par_id no-undo.

/*H0Z4*/ define variable l_tr_type like tr_type no-undo.
/*J3K7*/ define variable l_par_recid    as   recid       no-undo.

/*J3K7*/ define buffer   b_abs_mstr     for abs_mstr.

/*H0Z4*/ /* MODIFIED CODE BELOW TO INCLUDE CHECK FOR WORKBENCH SHIPPERS */

/*H0Z4*/ /* SINCE sod_site CAN BE CHANGED AFTER CREATION OF THE SHIPPER  */
/*H0Z4*/ /* THE CONDITION abs_shipfrom =  sod_site HAS BEEN REMOVED FROM */
/*H0Z4*/ /* SELECTION CRITERIA.                                          */

/*H0Z4** BEGIN DELETE **
 *   for each abs_mstr
 *   where abs_shipfrom = sodsite and abs_dataset = "sod_det"
 *   and abs_order = sonbr and abs_line = string(sodline) no-lock.
 *      shipper_found = shipper_found + 1.
 *      if shipper_found = 1 then save_abs = abs_par_id.
 *   end.
 *H0Z4** BEGIN DELETE */


/*H0Z4*/ for each abs_mstr
/*H0Z4*/ where abs_order    = sonbr   and
/*H0Z4*/       abs_id begins  "i"     and
/*H0Z4*/       abs_type     = "s"     and
/*H0Z4*/       abs_line     = string(sodline) no-lock:
/*GUI*/ if global-beam-me-up then undo, leave.


/*J3K7*/    /* FOR KIT ITEMS, SKIP THE CHILD RECORDS */
/*J3K7*/    if substring(abs_par_id,1,1) = "i" then
/*J3K7*/       next.

/*H0Z4*/    {gprun.i ""icshtyp.p"" "(input recid(abs_mstr) , output l_tr_type)"}
/*GUI*/ if global-beam-me-up then undo, leave.

/*J3K7** /*H0Z4*/ifl_tr_type="ISS-SO" then shipper_found = shipper_found + 1. */

/*N0WD*/  {&RCSDDELB-P-TAG1}
/*J3K7*/    if l_tr_type = "ISS-SO" then
/*N0WD*/  {&RCSDDELB-P-TAG2}
/*J3K7*/    do:

/*J3K7*/       /* ACCUMULATE CONFIRMED SHIPPERS */
/*J3K7*/       if abs_qty = abs_ship_qty then
/*J3K7*/       do:
/*J3K7*/          l_conf_ship = l_conf_ship + 1.

/*J3K7*/          if l_conf_ship = 1 then do:

/*J3K7*/             /* FIND TOP LEVEL SHIPPER, IF THE PARENT IS NOT SHIPPER */
/*J3K7*/             if substring(abs_par_id,1,1) <> "s" then do:

/*J3K7*/                /* FIND TOP LEVEL SHIPPER */
/*J3K7*/                {gprun.i ""gpabspar.p"" "(input recid(abs_mstr),
                                                  input 'S',
                                                  input false,
                                                  output l_par_recid)" }
/*GUI*/ if global-beam-me-up then undo, leave.

/*J3K7*/                if l_par_recid <> ?
/*J3K7*/                then do :
/*J3K7*/                   for first b_abs_mstr
/*J3K7*/                      fields (abs_id abs_line abs_order abs_par_id
/*J3K7*/                              abs_qty abs_ship_qty abs_type)
/*J3K7*/                      where recid(b_abs_mstr) = l_par_recid no-lock :
/*J3K7*/                   end. /* FOR FIRST B_ABS_MSTR */

/*J3K7*/                   if available b_abs_mstr then
/*J3K7*/                      l_conf_shid = b_abs_mstr.abs_id.
/*J3K7*/                end. /* IF L_PAR_RECID <> ? */

/*J3K7*/             end. /* IF SUBSTRING(ABS_PAR_ID,1,1) <> "S" */

/*J3K7*/             else
/*J3K7*/                l_conf_shid = abs_mstr.abs_par_id.
/*J3K7*/          end. /* IF L_CONF_SHIP = 1 */

/*J3K7*/       end. /* IF ABS_QTY = ABS_SHIP_QTY */

/*J3K7*/       /* ACCUMULATE UNCONFIRMED SHIPPERS */
/*J3K7*/       else do:
/*J3K7*/          shipper_found = shipper_found + 1.
/*J3K7** /*H0Z4*/          if shipper_found = 1 then save_abs = abs_par_id. */
/*J3K7*/          if shipper_found = 1 then save_abs = abs_mstr.abs_par_id.
/*J3K7*/       end. /*  ABS_QTY <> ABS_SHIP_QTY */

/*J3K7*/    end.
/*GUI*/ if global-beam-me-up then undo, leave.
 /* IF L_TR_TYPE = "ISS-SO" */

/*H0Z4*/  end. /* FOR EACH ABS_MSTR */
